﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
//using System.Xml.Linq;

using YouHP.Pages;
using YouHP.BLL;
using YouHP.Model;
using YouHP.Utility;

namespace web.aspx
{
    public partial class template : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GetPages(object sender, EventArgs e)
        {
            YouHP.Pages.PageTemplate template = new YouHP.Pages.PageTemplate();
            string savepath = YouHP.Utility.Utils.GetMapPath("~/pages/alpha/");
            template.CreateTemplate("alpha", savepath);
            this.ClearMessage();
            this.AddMessage("页面生成成功  " + savepath);
            this.AddMessage(DateTime.Now.ToString());
        }

        protected void testLogin(object sender, EventArgs e)
        {
            UserInfo user = UserBLL.Instance.CheckUserLogin("eptekssam", Utils.MD5("123456", 16));
            this.testBtn.Text = "" + user.Id;
        }

        protected void testRegister(object sender, EventArgs e)
        {
            UserInfo user = new UserInfo();
            user.UserName = "eptekssam";
            user.Email = "eptekssam@epteks.com";
            user.Password = Utils.MD5("123456", 16);
            user.UserTypeId = Constants.USER_PATIENT;
            user.Privacy = Constants.PUBLIC_WEB;

            if (UserBLL.Instance.CreateNewUser(user, "pwd"))
            {
                this.registedBtn.Text = "成功";
            }
            else
            {
                this.registedBtn.Text = "失败";
            }
        }

        protected void testGetProfile(object sender, EventArgs e)
        {
            UserInfo user = UserBLL.Instance.GetUserInfo(1);
            if (user != null)
            {
                this.getProfileBtn.Text = user.UserName;
            }
        }

        protected void testUpdateProfile(object sender, EventArgs e)
        {
            UserInfo user = new UserInfo();
            user.Gender = "男";
            user.Birthday = DateTime.Now;
            user.CityId = 1;
            user.ProvinceId = 1;
            user.Address = "张江镇";
            user.ZipCode = "201203";
            user.Telephone = "01038764688";
            user.MobilePhone = "15921668732";
            user.Interests = "游戏、乒乓球";
            user.Description = "无业游民";
            user.Privacy = 1;
            user.Id = 1;

            if (UserBLL.Instance.UpdateUserProfile(user))
            {
                this.updateProfileBtn.Text = "成功";
            }
            else
            {
                this.updateProfileBtn.Text = "失败";
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<UserInfo> usrlst = UserBLL.Instance.SearchPatientsList(10, 1, out count);
            string msg ;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个用户", count);
            this.AddMessage(msg);
            foreach (UserInfo info in usrlst)
            {
                msg = string.Format("{0} - {1}",info.Id,info.UserName);
                this.AddMessage(msg);
            }
        }


        private void ClearMessage()
        {
            TextBox1.Text = "";
        }
        private void AddMessage(string msg)
        {
            TextBox1.Text += "\r\n" + msg;
        }

        #region 疾病测试

        private void ShowDiseaseList()
        {
            int count = 0;
            List<DiseaseInfo> dszlst = DiseaseBLL.Instance.GetDiseaseList(10, 1, out count);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个疾病", count);
            this.AddMessage(msg);
            foreach (DiseaseInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.PinYin);
                this.AddMessage(msg);
            }
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            Random rnd = new Random();
            DiseaseInfo info = new DiseaseInfo();
            info.Name = "疾病" + rnd.Next(9);
            info.PinYin = Chinese.GetPingYinFirstLetter(info.Name);
            info.Intro = "简介";
            info.Desp = "描述";
            info.Type = 1;
            info.UpdateTime = DateTime.Now;
            DiseaseBLL.Instance.AddDisease(info);

            ShowDiseaseList();
        }

        protected void BtnDiseaseList_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<DiseaseInfo> dszlst = DiseaseBLL.Instance.GetDiseaseList(1, 1, out count);
            DiseaseInfo info = dszlst[0];
            info.Name += "_A";
            info.Intro = "";
            info.Desp = "";
            DiseaseBLL.Instance.UpdateDisease(info);
            ShowDiseaseList();
        }

        protected void BtnDelDisease_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<DiseaseInfo> dszlst = DiseaseBLL.Instance.GetDiseaseList(1, 1, out count);
            DiseaseInfo info = dszlst[0];
            int[] idlst = new int[] { info.Id };
            DiseaseBLL.Instance.DeleteDisease(idlst);
            ShowDiseaseList();
        }
        protected void BtnListDiseaseByType_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<DiseaseInfo> dszlst = DiseaseBLL.Instance.GetDiseaseByType(10, 1, 1,out count);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个疾病", count);
            this.AddMessage(msg);
            foreach (DiseaseInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.PinYin);
                this.AddMessage(msg);
            }
        }

        protected void BtnListDiseaseByPinYin_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<DiseaseInfo> dszlst = DiseaseBLL.Instance.GetDiseaseByPinYin(10, 1, "JB", out count);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个疾病", count);
            this.AddMessage(msg);
            foreach (DiseaseInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.PinYin);
                this.AddMessage(msg);
            }
        }

        protected void BtnListDiseaseByName_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<DiseaseInfo> dszlst = DiseaseBLL.Instance.GetDiseaseByName(10, 1, "病", out count);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个疾病", count);
            this.AddMessage(msg);
            foreach (DiseaseInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.PinYin);
                this.AddMessage(msg);
            }
        }

        #endregion

        #region 疾病类型测试

        protected void AddDiseaseType_Click(object sender, EventArgs e)
        {
            this.ClearMessage();
            DiseaseTypeInfo info = new DiseaseTypeInfo();
            info.Name = "消化道疾病";
            info.ParentId = 0;
            DiseaseBLL.Instance.AddDiseaseType(info);

            List<DiseaseTypeInfo>  dszlst = DiseaseBLL.Instance.GetDiseaseTypeList(0);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个疾病类型", dszlst.Count);
            this.AddMessage(msg);
            foreach (DiseaseTypeInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.ParentId);
                this.AddMessage(msg);
            }
        }

        protected void BtnUpdateDiseaseTye_Command(object sender, EventArgs e)
        {
            int count = 0;
            List<DiseaseTypeInfo> dszlst = DiseaseBLL.Instance.GetDiseaseTypeList(0);
            dszlst[0].Name += "__A";            
            DiseaseBLL.Instance.UpdateDiseaseType(dszlst[0]);

            dszlst = DiseaseBLL.Instance.GetDiseaseTypeList(0);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个疾病类型", count);
            this.AddMessage(msg);
            foreach (DiseaseTypeInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.ParentId);
                this.AddMessage(msg);
            }
        }

        protected void BtnDelDiseaseTye_Command(object sender, EventArgs e)
        {
            int count = 0;
            List<DiseaseTypeInfo> dszlst = DiseaseBLL.Instance.GetDiseaseTypeList(0);
            int[] idlst = new int[]{dszlst[0].Id};
            DiseaseBLL.Instance.DelDiseaseType(idlst);

            dszlst = DiseaseBLL.Instance.GetDiseaseTypeList(0);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个疾病类型", count);
            this.AddMessage(msg);
            foreach (DiseaseTypeInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.ParentId);
                this.AddMessage(msg);
            }
        }


        #endregion

        #region 地区测试
        protected void BtnAddArea_Click(object sender, EventArgs e)
        {
            /*
            Random rnd = new Random();
            AreaInfo info = new AreaInfo();
            info.Name = "地区" + rnd.Next(10);
            info.ParentId = rnd.Next(10);
            info.OrderValue = rnd.Next(10);
            AreaBLL.Instance.AddArea(info);

            List<AreaInfo> infoLst = AreaBLL.Instance.GetAreaList();
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个地区", infoLst.Count);
            this.AddMessage(msg);
            foreach (AreaInfo item in infoLst)
            {
                msg = string.Format("{0} - {1} - {2} - {3}", item.Id, item.Name, item.ParentId,item.OrderValue);
                this.AddMessage(msg);
            }
            */
        }

        protected void BtnUpdateArea_Click(object sender, EventArgs e)
        {
            /*
            List<AreaInfo> infoLst = AreaBLL.Instance.GetAreaList();
            infoLst[0].Name += "_5";
            infoLst[0].OrderValue++;
            infoLst[0].ParentId++;
            AreaBLL.Instance.UpdateArea(infoLst[0]);

            infoLst = AreaBLL.Instance.GetAreaList();
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个地区", infoLst.Count);
            this.AddMessage(msg);
            foreach (AreaInfo item in infoLst)
            {
                msg = string.Format("{0} - {1} - {2} - {3}", item.Id, item.Name, item.ParentId, item.OrderValue);
                this.AddMessage(msg);
            }
            */
        }

        protected void BtnDelArea_Click(object sender, EventArgs e)
        {
            /*
            List<AreaInfo> infoLst = AreaBLL.Instance.GetAreaList();
            int[] idlst = new int[] { infoLst[0].Id };
            AreaBLL.Instance.DelArea(idlst);

            infoLst = AreaBLL.Instance.GetAreaList();
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个地区", infoLst.Count);
            this.AddMessage(msg);
            foreach (AreaInfo item in infoLst)
            {
                msg = string.Format("{0} - {1} - {2} - {3}", item.Id, item.Name, item.ParentId, item.OrderValue);
                this.AddMessage(msg);
            }
             */
        }
        #endregion

        #region 症状类型测试

        private void ListSymptomType()
        {
            List<SymptomTypeInfo> infoLst;
            infoLst = SymptomBLL.Instance.GetSymptomTypeList();
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个症状类型", infoLst.Count);
            this.AddMessage(msg);
            foreach (SymptomTypeInfo item in infoLst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.ParentId);
                this.AddMessage(msg);
            }
        }

        protected void BtnAddSymptomType_Click(object sender, EventArgs e)
        {
            SymptomTypeInfo info = new SymptomTypeInfo();
            Random rnd = new Random();
            info.Name = "症状类型" + rnd.Next(9);
            info.ParentId = rnd.Next(9);
            SymptomBLL.Instance.AddSymptomType(info);

            ListSymptomType();
        }

        protected void BtnUpdateSymptomType_Click(object sender, EventArgs e)
        {
            List<SymptomTypeInfo> infoLst;
            infoLst = SymptomBLL.Instance.GetSymptomTypeList();
            SymptomTypeInfo info = infoLst[0];
            info.Name += "_A";
            info.ParentId++;
            SymptomBLL.Instance.UpdateSymptomType(info);

            ListSymptomType();
        }

        protected void BtnDelSymptomType_Click(object sender, EventArgs e)
        {
            List<SymptomTypeInfo> infoLst;
            infoLst = SymptomBLL.Instance.GetSymptomTypeList();
            SymptomTypeInfo info = infoLst[0];
            int[] itemIds = new int[] { info.Id };
            SymptomBLL.Instance.DelSymptomType(itemIds);

            ListSymptomType();
        }

        #endregion

        #region 症状测试

        private void ListSymptom()
        {
            List<SymptomInfo> infoLst;
            int count = 0;
            infoLst = SymptomBLL.Instance.GetSymptomList(100,1,out count);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个症状", count);
            this.AddMessage(msg);
            foreach (SymptomInfo item in infoLst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id,item.Name,item.PinYin);
                this.AddMessage(msg);
            }
        }

        protected void LinkButton4_Click(object sender, EventArgs e)
        {
            SymptomInfo info = new SymptomInfo();
            Random rnd = new Random();
            info.Name = "症状-" + rnd.Next(9);
            info.PinYin = Chinese.GetPingYinFirstLetter(info.Name);
            info.Type = 1;
            info.Intro = "介绍";
            info.Desp = "描述";
            info.UpdateTime = DateTime.Now;
            SymptomBLL.Instance.AddSymptom(info);

            ListSymptom();
        }

        protected void BtnUpdateSymptom_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<SymptomInfo> infoLst = SymptomBLL.Instance.GetSymptomList(1, 1, out count);
            SymptomInfo info = infoLst[0];
            info.Name += "_A";
            info.Desp = "";
            info.Intro = "";
            SymptomBLL.Instance.UpdateSymptom(info);
            ListSymptom();
        }

        protected void BtnDelSymptom_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<SymptomInfo> infoLst = SymptomBLL.Instance.GetSymptomList(1, 1, out count);
            SymptomInfo info = infoLst[0];
            int[] ids = new int[] { info.Id };
            SymptomBLL.Instance.DeleteSymptom(ids);
            ListSymptom();
        }

        protected void BtnSymptomListByType_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<SymptomInfo> dszlst = SymptomBLL.Instance.GetSymptomByType(10, 1, 1, out count);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个疾病", count);
            this.AddMessage(msg);
            foreach (SymptomInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.PinYin);
                this.AddMessage(msg);
            }
        }

        protected void BtnSymptomListByPinYin_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<SymptomInfo> dszlst = SymptomBLL.Instance.GetSymptomByPinYin(10, 1, "ZZ", out count);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个症状", count);
            this.AddMessage(msg);
            foreach (SymptomInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.PinYin);
                this.AddMessage(msg);
            }
        }

        protected void BtnListSymptomByName_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<SymptomInfo> dszlst = SymptomBLL.Instance.GetSymptomByName(10, 1, "状", out count);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个症状", count);
            this.AddMessage(msg);
            foreach (SymptomInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.PinYin);
                this.AddMessage(msg);
            }
        }


        #endregion

        #region 治疗类型测试

        private void ListTreatmentType()
        {
            List<TreatmentTypeInfo> infoLst;
            infoLst = TreatmentBLL.Instance.GetTreatmentTypeList();
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个治疗类型", infoLst.Count);
            this.AddMessage(msg);
            foreach (TreatmentTypeInfo item in infoLst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name,item.ParentId);
                this.AddMessage(msg);
            }
        }

        protected void BtnAddTreatmentType_Click(object sender, EventArgs e)
        {
            TreatmentTypeInfo info = new TreatmentTypeInfo();
            Random rnd = new Random();
            info.Name = "治疗类型" + rnd.Next(9);
            info.ParentId = rnd.Next(9);
            TreatmentBLL.Instance.AddTreatmentType(info);

            ListTreatmentType();
        }

        protected void BtnUpdateTreatmentType_Click(object sender, EventArgs e)
        {
            List<TreatmentTypeInfo> infoLst;
            infoLst = TreatmentBLL.Instance.GetTreatmentTypeList();
            TreatmentTypeInfo info = infoLst[0];
            info.Name += "_A";
            TreatmentBLL.Instance.UpdateTreatmentType(info);

            ListTreatmentType();
        }

        protected void BtnDelTreatmentType_Click(object sender, EventArgs e)
        {
            List<TreatmentTypeInfo> infoLst;
            infoLst = TreatmentBLL.Instance.GetTreatmentTypeList();
            TreatmentTypeInfo info = infoLst[0];
            int[] ids = new int[] { info.Id };
            TreatmentBLL.Instance.DelTreatmentType(ids);

            ListTreatmentType();
        }

        #endregion

        #region 治疗测试

        private void ListTreatment()
        {
            List<TreatmentInfo> infoLst;
            int count = 0;
            infoLst = TreatmentBLL.Instance.GetTreatmentList(100, 1, out count);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个治疗", count);
            this.AddMessage(msg);
            foreach (TreatmentInfo item in infoLst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.PinYin);
                this.AddMessage(msg);
            }
        }

        protected void BtnAddTreatment_Click(object sender, EventArgs e)
        {
            TreatmentInfo info = new TreatmentInfo();
            Random rnd = new Random();
            info.Name = "治疗-" + rnd.Next(9);
            info.PinYin = Chinese.GetPingYinFirstLetter(info.Name);
            info.Type = 1;
            info.Intro = "介绍";
            info.Desp = "描述";
            info.UpdateTime = DateTime.Now;
            TreatmentBLL.Instance.AddTreatment(info);

            ListTreatment();
        }

        protected void BtnUpdateTreatment_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<TreatmentInfo> infoLst = TreatmentBLL.Instance.GetTreatmentList(1, 1, out count);
            TreatmentInfo info = infoLst[0];
            info.Name += "_A";
            info.Desp = "";
            info.Intro = "";
            TreatmentBLL.Instance.UpdateTreatment(info);
            ListTreatment();
        }

        protected void BtnDelTreatment_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<TreatmentInfo> infoLst = TreatmentBLL.Instance.GetTreatmentList(1, 1, out count);
            TreatmentInfo info = infoLst[0];
            int[] ids = new int[] { info.Id };
            TreatmentBLL.Instance.DeleteTreatment(ids);
            ListTreatment();
        }

        protected void BtnTreatmentListByPinyin_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<TreatmentInfo> dszlst = TreatmentBLL.Instance.GetTreatmentByPinYin(10, 1, "ZL", out count);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个治疗", count);
            this.AddMessage(msg);
            foreach (TreatmentInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.PinYin);
                this.AddMessage(msg);
            }
        }

        protected void BtnTreatmentListByType_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<TreatmentInfo> dszlst = TreatmentBLL.Instance.GetTreatmentByType(10, 1, 1, out count);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个治疗", count);
            this.AddMessage(msg);
            foreach (TreatmentInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.PinYin);
                this.AddMessage(msg);
            }
        }

        protected void BtnListTreatmentByName_Click(object sender, EventArgs e)
        {
            int count = 0;
            List<TreatmentInfo> dszlst = TreatmentBLL.Instance.GetTreatmentByName(10, 1, "疗", out count);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个治疗", count);
            this.AddMessage(msg);
            foreach (TreatmentInfo item in dszlst)
            {
                msg = string.Format("{0} - {1} - {2}", item.Id, item.Name, item.PinYin);
                this.AddMessage(msg);
            }
        }


        #endregion

        #region Area
        protected void BtnGetProvince_Click(object sender, EventArgs e)
        {
            List<AreaInfo> infoLst = AreaBLL.Instance.GetProvinceList();
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个省份", infoLst.Count);
            this.AddMessage(msg);
            foreach (AreaInfo item in infoLst)
            {
                msg = string.Format("{0} - {1}", item.ProvinceId, item.ProvinceName);
                this.AddMessage(msg);
            }
        }

        protected void BtnGetCity_Click(object sender, EventArgs e)
        {
            List<AreaInfo> infoLst = AreaBLL.Instance.GetAreaListByProvice(0);
            string msg;
            this.ClearMessage();
            msg = string.Format("共找到 {0} 个城市", infoLst.Count);
            this.AddMessage(msg);
            foreach (AreaInfo item in infoLst)
            {
                msg = string.Format("{0} - {1}", item.CityId, item.CityName);
                this.AddMessage(msg);
            }
        }
        #endregion

        #region 数据库测试

        protected void BtnDatabaseInstall_Click(object sender, EventArgs e)
        {
            this.ClearMessage();
            try
            {
                DatabaseBLL.Instance.InstallDatabase();
                this.AddMessage("安装成功");
            }
            catch (Exception exp)
            {
                this.AddMessage("安装失败");
                this.AddMessage(exp.ToString());
            }
        }

        protected void LinkButton4_Click1(object sender, EventArgs e)
        {
            this.ClearMessage();
            try
            {
                DatabaseBLL.Instance.InstallSP();
                this.AddMessage("安装成功");
            }
            catch (Exception exp)
            {
                this.AddMessage("安装失败");
                this.AddMessage(exp.ToString());
            }
        }


        #endregion

        #region DiseaseSymptom

        protected void BtnDiseaseSymptomAdd_Click(object sender, EventArgs e)
        {
            int count;
            this.ClearMessage();
            List<DiseaseInfo> lstdisease = DiseaseBLL.Instance.GetDiseaseList(1, 1, out count);
            //List<SymptomInfo> lstsymptom = SymptomBLL.Instance.GetSymptomList(15, 1, out count);

            //DiseaseBLL.Instance.AddDiseaseSymptom(lstdisease[0].Id,lstsymptom);


            List<DiseaseSymptomInfo> lstdszsym = DiseaseBLL.Instance.GetDiseaseSymptomList(lstdisease[0].Id);
            foreach (DiseaseSymptomInfo info in lstdszsym)
            {
                string msg = string.Format("dszsym {0}-{1} ", info.Id, info.SymptomName);
                this.AddMessage(msg);
            }
        }

        protected void BtnDiseaseSymptomDel_Click(object sender, EventArgs e)
        {
            int count;
            List<DiseaseInfo> lstdisease = DiseaseBLL.Instance.GetDiseaseList(1, 1, out count);
            List<DiseaseSymptomInfo> lstdszsym = DiseaseBLL.Instance.GetDiseaseSymptomList(lstdisease[0].Id);
            int[] idlst = new int[] { lstdszsym[0].Id };
            this.ClearMessage();
            DiseaseBLL.Instance.DelDiseaseSymptoms(idlst);
            lstdszsym = DiseaseBLL.Instance.GetDiseaseSymptomList(lstdisease[0].Id);
            foreach (DiseaseSymptomInfo info in lstdszsym)
            {
                string msg = string.Format("dszsym {0}-{1} ", info.Id, info.SymptomName);
                this.AddMessage(msg);
            }
        }

        #endregion

        #region 疾病治疗
        protected void BtnDiseaseTreatmentAdd_Click(object sender, EventArgs e)
        {
            int count;
            this.ClearMessage();
            List<DiseaseInfo> lstdisease = DiseaseBLL.Instance.GetDiseaseList(1, 1, out count);
            List<TreatmentInfo> lsttreatment = TreatmentBLL.Instance.GetTreatmentList(15, 1, out count);

            //DiseaseBLL.Instance.AddDiseaseTreatment(lstdisease[0].Id, lsttreatment);


            List<DiseaseTreatmentInfo> lstdsztrm = DiseaseBLL.Instance.GetDiseaseTreatmentList(lstdisease[0].Id);
            foreach (DiseaseTreatmentInfo info in lstdsztrm)
            {
                string msg = string.Format("dsztrm {0}-{1} ", info.Id, info.TreatmentName);
                this.AddMessage(msg);
            }
        }

        protected void BtnDiseaseTreatmentDel_Click(object sender, EventArgs e)
        {
            int count;
            List<DiseaseInfo> lstdisease = DiseaseBLL.Instance.GetDiseaseList(1, 1, out count);
            List<DiseaseTreatmentInfo> lstdsztrm = DiseaseBLL.Instance.GetDiseaseTreatmentList(lstdisease[0].Id);
            int[] idlst = new int[] { lstdsztrm[0].Id };
            DiseaseBLL.Instance.DelDiseaseTreatment(idlst);
            lstdsztrm = DiseaseBLL.Instance.GetDiseaseTreatmentList(lstdisease[0].Id);
            this.ClearMessage();
            foreach (DiseaseTreatmentInfo info in lstdsztrm)
            {
                string msg = string.Format("dsztrm {0}-{1} ", info.Id, info.TreatmentName);
                this.AddMessage(msg);
            }
        }
        #endregion


        

    }
}
